import {createRouter, createWebHistory} from "vue-router/dist/vue-router";
import LoginVue from "../views/Login";
import LayoutVue from "../views/Layout";
import ArticleCategoryVue from "../views/article/ArticleCategory";
import ArticleManageVue from "../views/article/ArticleManage";
import UserInfoVue from "../views/user/UserInfo";
import UserAvatarVue from "../views/user/UserAvatar";
import UserResetPasswordVue from "../views/user/UserResetPassword";

// 创建路由关系
const routes = [
    {
        path: '/login',
        component: LoginVue
    },
    {
        path: '/',
        component: LayoutVue,
        // 重定向到文章管理页面
        redirect: '/article/manage',
        // 子路由
        children: [
            {
                path: '/article/category',
                component: ArticleCategoryVue
            },
            {
                path: '/article/manage',
                component: ArticleManageVue
            },
            {
                path: '/user/info',
                component: UserInfoVue
            },
            {
                path: '/user/avatar',
                component: UserAvatarVue
            },
            {
                path: '/user/resetPassword',
                component: UserResetPasswordVue
            },
        ]
    },
]


// 创建路由
const router = createRouter({
    history: createWebHistory(),
    routes: routes
});

export default router